package com.ruoyi.zyc;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.sdk.sms.api.ISmsGateWayApi;
import com.ruoyi.common.sdk.sms.vo.request.SendMsgRequest;
import com.ruoyi.common.sdk.sms.vo.respone.SendMsgRespone;
import com.ruoyi.framework.websocket.WebSocketServer;
import com.ruoyi.framework.websocket.WebSocketUsers;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ruoyi
 */
@Slf4j
@RestController
@RequestMapping("/websocket")
public class WebSocketController {

    /**
     * <pre>
     * 发送短信
     * </pre>
     */
    @PostMapping("/sendMessage")
    public AjaxResult sendMessage(@RequestParam String message) {
        try {
            /** 发送短信 */
            WebSocketUsers.sendMessageToUsersByText(message);
            return AjaxResult.success();
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error(e.getMessage());
        }
    }

}
